package my.app.timer;

import android.os.Bundle;

import com.google.android.youtube.player.YouTubeBaseActivity;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayer.OnInitializedListener;
import com.google.android.youtube.player.YouTubePlayerFragment;

public class FragmentDemoActivity extends YouTubeBaseActivity 
{
	static private final String DEVELOPER_KEY = "AIzaSyCXdnrTcWO7k0mvLd9YNliYmrCQ5mCxRMU";
    static private final String VIDEO = "U2HSam9whDI";
    static private final String PLAYLIST = "PLMu1yl6cQMHz51JvpcXiOBPVCsdbZ65sj";
	  @Override
	  public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);

	    setContentView(R.layout.youtube_layout);

	    YouTubePlayerFragment youTubePlayerFragment =
	        (YouTubePlayerFragment) getFragmentManager().findFragmentById(R.id.youtube_view);
	    youTubePlayerFragment.initialize(DEVELOPER_KEY, (OnInitializedListener) this);
	  }

	  public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
	      boolean wasRestored) {
	    if (!wasRestored) {
	      player.cueVideo("U2HSam9whDI");
	    }
	  }

	  protected YouTubePlayer.Provider getYouTubePlayerProvider() {
	    return (YouTubePlayerFragment) getFragmentManager().findFragmentById(R.id.youtube_view);
	  }

	}